package cn.micai.base.io;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

/**
 * 描述：序列化
 * <p>
 *
 * @author: 赵新国
 * @date: 2018/6/7 12:10
 */
public class SerializeMain {

    public static void main(String [] args) {

        Employee emp = new Employee();
        emp.setEmployeeId(101);
        emp.setEmployeeName("Arpit");
        emp.setDepartment("CS");

        try {
            FileOutputStream fileOutputStream = new FileOutputStream("D://employee.ser");
            ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
            objectOutputStream.writeObject(emp);
            objectOutputStream.close();
            fileOutputStream.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
